<%@ CODEPAGE=65001 %>
<%Response.Charset="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>自定义表单</title>
<link href="css.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../inc/Admin.js"></script>
</HEAD>
<!--#include file="../inc/Const.asp" -->
<!--#include file="../inc/ConnSiteData.asp" -->
<!--#include file="CheckAdmin.asp"-->
<%
'cookie 验证
'if Instr(request.cookies("Martech_com")("AdminPurview"),"|9,")=0 then 
'  response.write ("<font color='red')>你不具有该管理模块的操作权限，请返回！</font>")
'  response.end
'end if

'session 验证
if Instr(session("AdminPurview"),"|9,")=0 then 
  response.write ("<font color='red')>你不具有该管理模块的操作权限，请返回！</font>")
  response.end
end if
'========判断是否具有管理权限
%>
<body>
<table border="0" cellspacing="1" cellpadding="0" height="0" align="center" width="100%" >
  <tr>
  <td>
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
  <tr>
    <td height="24" align="center" nowrap class=classtop><a href="?action=formadd" >添加新表单</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="?action=formlist" >查看所有表单</a></td>
  </tr>
</table>
<br />
<% Dim Action
Action=request.QueryString("Action")
Select Case Action
Case "formlist"
formlist()
Case "del"
del()
Case "formadd"
formadd()
Case "formaddsave"
formaddsave()
Case "formaddnext"
formaddnext()
Case "formaddnext1save"
formaddnext1save()
Case "formaddnext2"
formaddnext2()
Case "formaddnext2del"
formaddnext2del()
Case "formaddnext3"
formaddnext3()
Case "formaddnext3save"
formaddnext3save()
Case "formedit"
formedit()
Case "formeditsave"
formeditsave()
Case "formaddnext2edit"
formaddnext2edit()
Case "formaddnext2editsave"
formaddnext2editsave()
Case "formaddnext2edit1"
formaddnext2edit1()
Case "formaddnext2edit1save"
formaddnext2edit1save()
Case "formback"
formback()
Case "formbackdel"
formbackdel()
Case "formbackview"
formbackview()
End Select
 %>


<% function formlist() %>
<form id="form1" name="form1" action="" method="post" style=" margin:0;">
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
        <tr class=classtop>
          <td width="33%" height="25" align="center" valign="middle" ><font color="#FFFFFF"><strong>表单名称</strong></font></td>
          <td width="33%" align="center" valign="middle" ><font color="#FFFFFF"><strong>开关</strong></font></td>
          <td width="33%" align="center" valign="middle" ><font color="#FFFFFF"><strong>管理操作</strong></font></td>
        </tr>
<%
		sql="select * from Martech_Form order by id asc"
		set rs=Server.CreateObject("ADODB.RECORDSET")
		rs.open sql,conn,1,1
		if not rs.eof then
		pages=10
		rs.pageSize=pages
		allPages=rs.pageCount
		page=Request("page")
		if isEmpty(page) or Cint(page)<1 then
			page = 1
		elseif Cint(page)>allPages then
			page = allPages 
		end if
		rs.AbsolutePage = page
		do while not rs.eof and pages > 0
%>
		<tr class=classtd onMouseOver = "this.style.backgroundColor = '#ebebeb'" onMouseOut = "this.style.backgroundColor = ''" style='cursor:hand'>
		  <td width="33%" height="25" align="center" valign="middle" ><%=rs("name")%></td>
          <td width="33%" align="center" valign="middle" ><%if rs("k")=1 then Response.Write("<font color=""green"">开</font>") else Response.Write("<font color=""red"">关</font>")%></td>
          <td width="33%" align="center="middle" ><a href="?action=formedit&id=<%=rs("id")%>">修改</a>&nbsp;&nbsp;<a href="?action=formaddnext2&fid=<%=rs("id")%>">题目</a>&nbsp;&nbsp;<a href="?action=formback&fid=<%=rs("id")%>">数据</a>&nbsp;&nbsp;<% if rs("id")=1 or rs("id")=2 or rs("id")=3 then%><font color='red'>系统内置表单，不能删除</font><% else %><a href="?action=del&amp;id=<%=rs("id")%>&amp;page=<%=page%>"  onclick="javascript:return confirm('您确定要继续执行该操作吗？');">删除</a><% end if %></td>
        </tr>
<%
		pages = pages - 1
		rs.MoveNext
		loop
		end if
		rs.Close
		Set rs=Nothing
%>

              <tr class=classtd>
                <td align="center" colspan="3"><%pager allpages,page,""%></td>
                </tr>
</table>
</form>
<!-- 全选，反选脚本 -->
<script language="javascript">
function selectIt(action){
var testform=document.getElementById("form1");
for(var i=0 ;i<testform.elements.length;i++){
if(testform.elements[i].type=="checkbox"){
e=testform.elements[i];
e.checked=(action=="selectAll")?1:(!e.checked);
}
}
}
</script>
<%end function%>
<% 
function formadd()
%>

<form id="frm" method="post" action="?action=formaddsave">
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
  <tr>
 <td height="27" colspan="2" align="center" class="classtop"><strong>增加表单</strong></td>
</tr>

      <tr class=classtd>
        <td width="100" height="25" >表单名称</td>
        <td  align=left><input name="name" type="text" id="name" size="30" maxlength="50" />
          *管理用,并不会显示在前台</td>
      </tr>
      <tr class=classtd>
        <td height="25" >开关</td>
        <td height="25"  align=left><input name="k" type="radio" id="k" value="1" checked="checked" />
          开启
            &nbsp;
            <input name="k" type="radio" id="k" value="0" />
            关闭</td>
      </tr>
      <tr class=classtd>
        <td width="100" height="25" >&nbsp;</td>
        <td height="25" align=left>
          <input type="submit" name="Submit2" value=" 添 加 " />
&nbsp;&nbsp;
<input type="button" name="Submit3" value=" 返 回 " /></td>
      </tr> 
</table>
</form>
<% 
end function
function formaddnext()
fid	=Request.QueryString("fid")
sql="SELECT name FROM Martech_Form where id="&fid
Set rs=conn.execute(sql)
if not rs.eof then 
	name=rs(0)
else
	Response.Redirect("main.asp")
end if
rs.Close
Set rs=Nothing
%>
<form id="frm" method="post" action="?action=formaddnext1save&fid=<%=fid%>">
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
  <tr class=classtop>
    <td height="24" align="center" nowrap>表单名称:<span style="color:#FF0000; font-size:14px;"><strong><%=name%></strong></span>&nbsp;&nbsp;<a href="?action=formaddnext&fid=<%=fid%>" >【添加选择项目】</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="?action=formaddnext3&fid=<%=fid%>" >【添加输入项目】</a></td>  
  </tr>
  </table>

  <table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
		  <% call formaddnext1() %>

</table>
</form>
<% 
end function
function formaddnext1()
%>
<form style="margin:0" id="frm" method="post" action="?action=formaddnext1save">  
      <tr class=classtd>
        <td width="100" height="25" align="center" >类型</td>
        <td height="25"  align="left"><input name="t" type="radio" id="t" value="1" checked="checked" />单选&nbsp;<input name="t" type="radio" id="t" value="2" />多选&nbsp;<input name="t" type="radio" id="t" value="3" />下拉菜单&nbsp;<input name="fid" type="hidden" id="fid" value="<%=fid%>" /></td>
      </tr>
      <tr class=classtd>
        <td height="25" align="center" >验证</td>
        <td height="25" align="left" >
		<input name="y" type="radio" id="y" value="1" checked="checked" />必选&nbsp;<input name="y" type="radio" id="y" value="0" />可选</td>
      </tr>
     <tr class=classtd>
        <td height="25" align="center" >问题</td>
        <td height="25" align="left" >中文<input name="q" type="text" id="q" size="50" maxlength="80" />---英文<input name="eq" type="text" id="eq" size="50" maxlength="80" /></td>
      </tr>
     <tr class=classtd>
        <td height="25" align="center" >选项</td>
        <td height="25" align="left" >
	  <ul id="qul" style="list-style:none; margin:0; padding:0">
		<li>中<input name="a" type="text" id="a">英<input name="ea" type="text" id="ea">&nbsp;&nbsp;<span class="ts">注意：选项内容中不能含有&quot;|&quot;和&quot;,&quot;字符,请保证每个选项都有值,多余空项请删除</span></li>
		<li>中<input name="a" type="text" id="a">英<input name="ea" type="text" id="ea"></li>
		<li>中<input name="a" type="text" id="a">英<input name="ea" type="text" id="ea"></li>
	    </ul><span onClick="addqul();" style="cursor:hand;">增加选项(+)</span>&nbsp;&nbsp;<span onClick="delqul();" style="cursor:hand;">减少选项(-)</span>		</td>
      </tr>
      <tr class=classtd>
        <td height="25" align="center" >&nbsp;</td>
        <td height="25" align="left" ><input type="submit" name="Submit2" value=" 添 加 " /></td>
      </tr>
</form>
<%
end function
function formaddnext2()
fid	=Request("fid")
sql="SELECT name FROM Martech_Form where id="&fid
Set rs=conn.execute(sql)
if not rs.eof then 
	name=rs(0)
else
	url_return "有错误产生。"
end if
rs.Close
Set rs=Nothing
%>
<form id="form1" name="form1" action="" method="post" style=" margin:0;">
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
  <tr class=classtop>
    <td height="24" align="center" nowrap >表单名称:<span style="color:#FF0000; font-size:14px;"><strong><%=name%></strong></span>&nbsp;&nbsp;<a href="?action=formaddnext&fid=<%=fid%>" >【添加选择项目】</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="?action=formaddnext3&fid=<%=fid%>" >【添加输入项目】</a></td>  
  </tr>
  </table>

<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
        <tr class=classtop>
          <td height="25" align="center" valign="middle" ><font color="#FFFFFF"><strong>问题</strong></font></td>
          <td align="center" valign="middle" ><font color="#FFFFFF"><strong>类型</strong></font></td>
          <td align="center" valign="middle"><font color="#FFFFFF"><strong>必填</strong></font></td>
          <td align="center" valign="middle" ><font color="#FFFFFF"><strong>管理操作</strong></font></td>
        </tr>
<%
fid	=Request("fid")
		sql="select * from Martech_Form_q where fid="&fid&" order by id asc"
		set rs=Server.CreateObject("ADODB.RECORDSET")
		rs.open sql,conn,1,1
		do while not rs.eof
%>
		<tr class=classtd onMouseOver = "this.style.backgroundColor = '#ebebeb'" onMouseOut = "this.style.backgroundColor = ''" style='cursor:hand'>
		  <td height="25" align="center" valign="middle" class="leftt3"><%=rs("q")%>/<%=rs("eq")%></td>
          <td align="center" valign="middle" class="leftt3">
		  <%
		  select case rs("t")
		  case 1:Response.Write("单选"):tt=""
		  case 2:Response.Write("多选"):tt=""
		  case 3:Response.Write("下拉菜单"):tt=""
		  case 4:Response.Write("单行输入"):tt=1
		  case 5:Response.Write("多行输入"):tt=1
		  case else:Response.Write("<font color=""red"">未知(只能删除)</font>")
		  end select
		  %>		  </td>
          <td align="center" valign="middle" class="leftt3">
		  <%
		  if rs("y")=1 then Response.Write("是") else Response.Write("否")
		  %>
		  </td>
          <td align="center" valign="middle" class="leftt3"><a href="?action=formaddnext2edit<%=tt%>&fid=<%=rs("fid")%>&id=<%=rs("id")%>">修改</a>&nbsp;&nbsp;<a href="?action=formaddnext2del&amp;id=<%=rs("id")%>&amp;fid=<%=fid%>"  onclick="javascript:return confirm('您确定要继续执行该操作吗？');">删除</a></td>
        </tr>
<%
		rs.MoveNext
		loop
		rs.Close
		Set rs=Nothing
%>
 
</table>
</form>
<% 
end function 
function formaddnext3()
fid	=Request.QueryString("fid")
sql="SELECT name FROM Martech_Form where id="&fid
Set rs=conn.execute(sql)
if not rs.eof then 
	name=rs(0)
else
	Response.Redirect("main.asp")
end if
rs.Close
Set rs=Nothing
%>
<form id="frm" method="post" action="?action=formaddnext3save&fid=<%=fid%>">
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
  <tr class=classtop>
    <td height="24" align="center" nowrap >表单名称:<span style="color:#FF0000; font-size:14px;"><strong><%=name%></strong></span>&nbsp;&nbsp;<a href="?action=formaddnext&fid=<%=fid%>" >【添加选择项目】</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="?action=formaddnext3&fid=<%=fid%>" >【添加输入项目】</a></td>  
  </tr>
  </table>
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
         <form style="margin:0" id="frm" method="post" action="">   
      <tr class=classtd>
        <td width="100" height="25" align="center" >类型</td>
        <td height="25" align="left" ><input name="t" type="radio" id="t" value="4" checked="checked" />
          单行输入&nbsp;
          <input name="t" type="radio" id="t" value="5" />
          多行输入&nbsp;
          <input name="fid" type="hidden" id="fid" value="<%=fid%>" /></td>
      </tr>
      <tr class=classtd>
        <td height="25" align="center" >验证</td>
        <td height="25" align="left">
		<input name="y" type="radio" id="y" value="1" checked="checked" />
		必填&nbsp;
		<input name="y" type="radio" id="y" value="0" />
		选填</td>
      </tr>
      <tr class=classtd>
        <td height="25" align="center" >问题</td>
        <td height="25" align="left" >中<input name="q" type="text" id="q" size="50" maxlength="80" />英<input name="eq" type="text" id="eq" size="50" maxlength="80" /></td>
      </tr>
      <tr class=classtd>
        <td height="25" align="left" >&nbsp;</td>
        <td height="25" align="left" ><input type="submit" name="Submit2" value=" 添 加 " /></td>
      </tr>  
</form>
</table>
</form>
<% 
end function
function formedit() 
id=Request("id")
if id="" or not isnumeric(id) then url_return "参数错误!"
Set rs=Server.CreateObject("adodb.recordset")
sql="select * from Martech_Form where id="&id&""
rs.Open sql,conn,1,3
if rs.eof then url_return "没有找到指定信息!"
%>

<form id="frm" method="post" action="?action=formeditsave">
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
  <tr>
 <td height="27" colspan="4" align="center" class="classtop"><strong>修改表单</strong></td>
</tr>
      <tr class=classtd>
        <td width="100" height="25"  align="left">表单名称</td>
        <td align="left"><input name="name" type="text" id="name" value="<%=rs("name")%>" size="30" maxlength="50" />
          <input name="id" type="hidden" id="id" value="<%=id%>" />
          *管理用,并不会显示在前台</td>
      </tr>
      <tr class=classtd>
        <td height="25" align="left">开关</td>
        <td height="25" align="left"><input name="k" type="radio" id="k" value="1" <%if rs("k")=1 then Response.Write("checked")%> />
          开启
          &nbsp;
                <input name="k" type="radio" id="k" value="0"  <%if rs("k")=0 then Response.Write("checked")%> />
          关闭</td>
      </tr>     
      <tr class=classtd>
        <td width="100" height="25"  align="left">&nbsp;</td>
        <td height="25" align="left">
          <input type="submit" name="Submit2" value=" 修 改 " />
&nbsp;&nbsp;
<input type="button" name="Submit3" value=" 返 回 " onClick="history.back();" /></td>
      </tr>
</table>
</form>
<%
end function
function formaddnext2edit()
fid	=Request("fid")
sql="SELECT name FROM Martech_Form where id="&fid
Set rs=conn.execute(sql)
if not rs.eof then 
	name=rs(0)
else
	url_return "有错误产生。"
end if
rs.Close
Set rs=Nothing
id=Request("id")
sql="select * from Martech_Form_q where id="&id
Set rs=Server.CreateObject("adodb.recordset")
rs.Open sql,conn,1,3
%>
<form style="margin:0" id="frm" method="post" action="?action=formaddnext2editsave">
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
  <tr class=classtop>
    <td height="24" align="center" nowrap>表单名称:<span style="color:#FF0000; font-size:14px;"><strong><%=name%></strong></span>--<span style="color:#FF0000; font-size:14px;"><strong><%=rs("q")%></strong></span>&nbsp;&nbsp;<a href="?action=formaddnext&fid=<%=fid%>" >【添加选择项目】</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="?action=formaddnext3&fid=<%=fid%>" >【添加输入项目】</a></td>  
  </tr>
  </table>
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
     <tr class=classtd>
        <td width="100" height="25" align="left">类型</td>
        <td height="25" align="left" ><input name="t" type="radio" id="t" value="1" <%if rs("t")=1 then Response.Write("checked")%> />单选&nbsp;<input name="t" type="radio" id="t" value="2" <%if rs("t")=2 then Response.Write("checked")%> />多选&nbsp;<input name="t" type="radio" id="t" value="3" <%if rs("t")=3 then Response.Write("checked")%> />下拉菜单&nbsp;
          <input name="id" type="hidden" id="id" value="<%=id%>" /></td>
      </tr>
      <tr class=classtd>
        <td height="25" align="left">验证</td>
        <td height="25" align="left">
		<input name="y" type="radio" id="y" value="1" <%if rs("y")=1 then Response.Write("checked")%> />必选&nbsp;<input name="y" type="radio" id="y" value="0" <%if rs("y")=0 then Response.Write("checked")%> />可选</td>
      </tr>
      <tr class=classtd>
        <td height="25" align="left">问题</td>
        <td height="25" align="left">中<input name="q" type="text" id="q" value="<%=rs("q")%>" size="50" maxlength="80" />英<input name="eq" type="text" id="eq" value="<%=rs("eq")%>" size="50" maxlength="80" /></td>
      </tr>
      <tr class=classtd>
        <td height="25" align="left">选项</td>
        <td height="25" align="left">
	  <ul id="qul" style="list-style:none; margin:0; padding:0">
	  	<%
		ar=Split(rs("a"),"|")
		ear=Split(rs("ea"),"|")
		for i=LBOUND(ar) to UBOUND(ar)
		%>
		<li>中<input name="a" type="text" id="a" value="<%=trim(ar(i))%>">英<input name="ea" type="text" id="ea" value="<%=trim(ear(i))%>">
		</li>
		<%
		next
		%>		
	    </ul><span onClick="addqul();" style="cursor:hand; ">增加选项(+)</span>&nbsp;&nbsp;<span onClick="delqul();" style="cursor:hand;">减少选项(-)</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注意：选项内容中不能含有&quot;|&quot;和&quot;,&quot;字符,请保证每个选项都有值,多余空项请删除</td>
      </tr>
      <tr class=classtd>
        <td height="25" align="left">&nbsp;</td>
        <td height="25" align="left"><input type="submit" name="Submit2" value=" 修 改 " /></td>
      </tr> 
</table>
</form>
<% 
end function 
function formaddnext2edit1()
fid	=Request("fid")
sql="SELECT name FROM Martech_Form where id="&fid
Set rs=conn.execute(sql)
if not rs.eof then 
	name=rs(0)
else
	url_return "有错误产生。"
end if
rs.Close
Set rs=Nothing
id=Request("id")
sql="select * from Martech_Form_q where id="&id
Set rs=Server.CreateObject("adodb.recordset")
rs.Open sql,conn,1,3
%>
<form style="margin:0" id="frm" method="post" action="?action=formaddnext2edit1save">
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
  <tr>
    <td height="24" align="center" nowrap class=classtop>表单名称:<span style="color:#FF0000; font-size:14px;"><strong><%=name%></strong></span>--<span style="color:#FF0000; font-size:14px;"><strong><%=rs("q")%></strong></span>&nbsp;&nbsp;<a href="?action=formaddnext&fid=<%=fid%>" >【添加选择项目】</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="?action=formaddnext3&fid=<%=fid%>" >【添加输入项目】</a></td>  
  </tr>
  </table>
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
      <tr class=classtd>
        <td width="100" height="25" align="center" >类型</td>
        <td height="25" align="left" ><input name="t" type="radio" id="t" value="4" <%if rs("t")=4 then Response.Write("checked")%> />
          单行输入&nbsp;
          <input name="t" type="radio" id="t" value="5" <%if rs("t")=5 then Response.Write("checked")%> />
          多行输入&nbsp;
          <input name="id" type="hidden" id="id" value="<%=id%>" /></td>
      </tr>
      <tr class=classtd>
        <td height="25" align="center" >验证</td>
        <td height="25" align="left">
		<input name="y" type="radio" id="y" value="1" <%if rs("y")=1 then Response.Write("checked")%> />
		必填&nbsp;
		<input name="y" type="radio" id="y" value="0" <%if rs("y")=0 then Response.Write("checked")%> />
		选填</td>
      </tr>
      <tr class=classtd>
        <td height="25" align="center" >问题</td>
        <td height="25" align="left" >中<input name="q" type="text" id="q" value="<%=rs("q")%>" size="50" maxlength="80" />英<input name="eq" type="text" id="eq" value="<%=rs("eq")%>" size="50" maxlength="80" /></td>
      </tr>
      <tr class=classtd>
        <td height="25" align="left" >&nbsp;</td>
        <td height="25" align="left" ><input type="submit" name="Submit2" value=" 修 改 " /></td>
      </tr>
</table>
</form>
<% 
end function
function formback() 
fid	=Request("fid")
sql="SELECT name FROM Martech_form where id="&fid
Set rs=conn.execute(sql)
if not rs.eof then 
	name=rs(0)
else
	url_return "有错误产生。"
end if
rs.Close
Set rs=Nothing
%>
<form id="form1" name="form1" action="" method="post" style=" margin:0;">
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
  <tr>
    <td height="24" align="center" nowrap class=classtop>查看<span style="color:#FF0000; font-size:14px;"><strong><%=name%></strong></span>表单的反馈&nbsp;&nbsp;</td>  
  </tr>
  </table>
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%"> 
        <tr class=classtop>
          <td align="center" valign="middle"><font color="#FFFFFF"><strong>表单项一</strong></font></td>
          <td align="center" valign="middle" ><font color="#FFFFFF"><strong>表单项二</strong></font></td>
          <td height="25" align="center" valign="middle" ><font color="#FFFFFF"><strong>参与IP</strong></font></td>
          <td align="center" valign="middle" ><font color="#FFFFFF"><strong>参与时间</strong></font></td>
          <td align="center" valign="middle" ><font color="#FFFFFF"><strong>管理操作</strong></font></td>
        </tr>
<%
		sql="select * from Martech_form_c where fid="&fid&" order by id asc"
		set rs=Server.CreateObject("ADODB.RECORDSET")
		rs.open sql,conn,1,1
		do while not rs.eof
		ar=Split(rs("a"),"|")
%>
<tr class=classtd onMouseOver = "this.style.backgroundColor = '#ebebeb'" onMouseOut = "this.style.backgroundColor = ''" style='cursor:hand'>
		  <td align="left" valign="middle" class="leftt3"><%=ar(0)%></td>
		  <td align="left" valign="middle" class="leftt3"><%=ar(1)%></td>
		  <td height="25" align="left" valign="middle" class="leftt3"><%=rs("ip")%></td>
          <td align="left" valign="middle" class="leftt3">
		  <%=rs("addtime")%>		  </td>
          <td align="left" valign="middle" class="leftt3"><a href="?action=formbackview&id=<%=rs("id")%>">查看</a>&nbsp;&nbsp;<a href="?action=formbackdel&amp;id=<%=rs("id")%>&amp;fid=<%=fid%>"  onclick="javascript:return confirm('您确定要继续执行该操作吗？');">删除</a></td>
        </tr>
<%
		rs.MoveNext
		loop
		rs.Close
		Set rs=Nothing
%>
     
</table>
</form>
<% 
end function
function formbackview()
on error resume next '屏蔽一些常规错误
id	=Request("id")
sql="select * from Martech_form_c where id="&id
Set rs=Server.CreateObject("Adodb.recordset")
rs.Open sql,conn,1,1
info=rs("a")
ip=rs("ip")
addtime=rs("addtime")
fid=rs("fid")
rs.Close
Set rs=Nothing

sql="SELECT name FROM Martech_form where id="&fid
Set rs=conn.execute(sql)
if not rs.eof then 
	name=rs(0)
else
	name="未知表单"
end if
rs.Close
Set rs=Nothing
%>

<form id="form1" name="form1" action="" method="post" style=" margin:0;">
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">
  <tr>
    <td height="24" align="center" nowrap class=classtop>查看<span style="color:#FF0000; font-size:14px;"><strong><%=name%></strong></span>表单的反馈&nbsp;&nbsp;</td>  
  </tr>
  </table>
      <table border="0" cellspacing="1" cellpadding="3" bgcolor="#FFFFFF" align="center" width="100%">

            <tr class=classtd>
              <td width="100" height="25" align="left" valign="middle" class="leftt3">表单名称</td>
              <td align="left" valign="middle" class="leftt3"><%=name%></td>
            </tr>
<%
		ar=split(info,"|")
		sql="select * from Martech_form_q where fid="&fid&" order by id asc"
		set rs=Server.CreateObject("ADODB.RECORDSET")
		rs.open sql,conn,1,1
		i=-1
		do while not rs.eof
		i=i+1
%>			
           <tr class=classtd>
              <td height="25" align="left" valign="middle" class="leftt3"><%=rs("q")%></td>
              <td align="left" valign="middle" class="leftt3"><%=ar(i)%></td>
            </tr>
<%
		rs.MoveNext
		loop
		rs.Close
		Set rs=Nothing
%>
          <tr class=classtd>
              <td height="25" align="left" valign="middle" class="leftt3">参与时间</td>
              <td align="left" valign="middle" class="leftt3"><%=addtime%></td>
            </tr>
          <tr class=classtd>
              <td height="25" align="left" valign="middle" class="leftt3">参与IP</td>
              <td align="left" valign="middle" class="leftt3"><%=ip%>&nbsp;&nbsp;</td>
            </tr>
           <tr class=classtd>
              <td height="25" align="left" valign="middle">&nbsp;</td>
              <td align="left" valign="middle"><input type="button" name="Submit" value=" 返 回 " onClick="history.back();" /></td>
            </tr>
          </table>
    </td>
  </tr>  
</table>
</form>
<% end function %>
</td>
</tr>
</table>
</BODY>
</HTML>


 <%
 function del()
if Request.QueryString("action")="del" then
	id		=Request("id")
	page	=Request("page")
	if id="" then url_go "参数错误!","diy_frm_manage.asp?page="&page
	sql="delete from Martech_Form_q where fid="&id&""
	conn.execute(sql)
	sql="delete from Martech_Form_c where fid="&id&""
	conn.execute(sql)	
	sql="delete from Martech_Form where id="&id&""
	conn.execute(sql)

	url_go "删除成功!","?action=formlist"
end if
end function

function formaddsave()
if Request.QueryString("action")="formaddsave" then
	iempty "name#表单名称不能为空!"
	Set rs=Server.CreateObject("adodb.recordset")
	sql="select * from Martech_Form"
	rs.Open sql,conn,1,3
	rs.Addnew
	rs("name")		=Request.Form("name")
	rs("k")			=Request.Form("k")
	rs.Update
	id=rs("id")
	rs.Close
	Set rs=Nothing
	url_go "添加成功,请继续添加表单其他相关信息!","?action=formaddnext&fid="&id
end if
end function

function formaddnext1save()
fid=Request("fid")
if Request.QueryString("action")="formaddnext1save" then
	iempty "q#题目不能为空!$a#选项不能为空!"
	Set rs=Server.CreateObject("adodb.recordset")
	a=Request.Form("a")
	a=Replace(a,",","|")
	a=Replace(a," ","")
	sql="select * from Martech_Form_q where id=null"
	rs.Open sql,conn,1,3
	rs.Addnew
	rs("fid")	=fid
	rs("t")		=Request.Form("t")
	rs("q")		=Request.Form("q")
	rs("a")		=a
	rs("y")		=Request.Form("y")
	rs.Update
	rs.Close
	Set rs=Nothing
	url_go "添加成功,请继续添加表单其他相关信息!","?action=formaddnext2&fid="&fid
end if
end function

function formaddnext2del()
fid	=Request("fid")
if Request.QueryString("action")="formaddnext2del" then
	id		=Request("id")
	page	=Request("page")
	id		=Replace(id," ","")
	if id="" then
		url_go "参数错误!","?action=formaddnext2&fid="&fid
	end if
	sql="delete from Martech_Form_q where id in ("&id&")"
	conn.execute(sql)
	url_go "成功删除指定的信息!","?action=formaddnext2&fid="&fid
end if
end function

function formaddnext3save()
fid=Request("fid")
if Request.QueryString("action")="formaddnext3save" then
	iempty "q#题目不能为空!"
	Set rs=Server.CreateObject("adodb.recordset")
	sql="select * from Martech_Form_q where id=null"
	rs.Open sql,conn,1,3
	rs.Addnew
	rs("fid")	=Request.Form("fid")	
	rs("t")		=Request.Form("t")
	rs("q")		=Request.Form("q")
	rs("y")		=Request.Form("y")
	rs.Update
	rs.Close
	Set rs=Nothing
	url_go "添加成功,请继续添加表单其他相关信息!","?action=formaddnext2&fid="&fid
end if
end function

function formeditsave()
id=Request("id")
if id="" or not isnumeric(id) then url_return "参数错误!"
Set rs=Server.CreateObject("adodb.recordset")
sql="select * from Martech_Form where id="&id&""
rs.Open sql,conn,1,3
if rs.eof then url_return "没有找到指定信息!"
if Request.QueryString("action")="formeditsave" then
	iempty "name#表单名称不能为空!"
	rs("name")		=Request.Form("name")
	rs("k")		=Request.Form("k")
	rs.Update
	rs.Close
	Set rs=Nothing
	url_go "修改成功!","?action=formlist"
end if
end function

function formaddnext2editsave()
id=Request("id")
fid=Request("fid")
sql="select * from Martech_Form_q where id="&id
Set rs=Server.CreateObject("adodb.recordset")
rs.Open sql,conn,1,3
if Request.QueryString("action")="formaddnext2editsave" then
	iempty "q#题目不能为空!$a#选项不能为空!"
	a=Request.Form("a")
	a=Replace(a,",","|")
	a=Replace(a," ","")
	rs("t")		=Request.Form("t")
	rs("q")		=Request.Form("q")
	rs("a")		=a
	rs("y")		=Request.Form("y")
	rs.Update
	rs.Close
	Set rs=Nothing
	url_go "修改成功!","?action=formlist"
	Response.End()
end if
end function

function formaddnext2edit1save()
id=Request("id")
sql="select * from Martech_Form_q where id="&id
Set rs=Server.CreateObject("adodb.recordset")
rs.Open sql,conn,1,3

if Request.QueryString("action")="formaddnext2edit1save" then
	iempty "q#题目不能为空!"
	rs("t")		=Request.Form("t")
	rs("q")		=Request.Form("q")
	rs("y")		=Request.Form("y")
	rs.Update
	rs.Close
	Set rs=Nothing
	url_go "修改成功!","?action=formlist"
	Response.End()
end if
end function 

function formbackdel()
fid	=Request("fid")
if Request.QueryString("action")="formbackdel" then
	id		=Request("id")
	page	=Request("page")
	id		=Replace(id," ","")
	if id="" then
		url_go "参数错误!","?action=formback&fid="&fid
	end if
	sql="delete from Martech_form_c where id in ("&id&")"
	conn.execute(sql)
	url_go "成功删除指定的信息!","?action=formback&fid="&fid
end if

sql="SELECT name FROM Martech_form where id="&fid
Set rs=conn.execute(sql)
if not rs.eof then 
	name=rs(0)
else
	url_return "有错误产生。"
end if
rs.Close
Set rs=Nothing
end function
%>